package com.amose.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.Date;

/**
 * @author yangpeng
 * @time 2020/3/9
 * @since 1.0.0
 */
@Controller
@RequestMapping("/demo")
public class DemoController {

    @RequestMapping("/handle01")
    public ModelAndView handle01() {
        Date date = new Date();
        ModelAndView modelAndView = new ModelAndView();
//        向请求域中放入值，相当于request.setAttrivute("date",date)
        modelAndView.addObject("date", date);
//        逻辑视图名
        modelAndView.setViewName("success");
        return modelAndView;
    }
}
